<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<link rel="stylesheet" href="css/external/codemirror.css" />
<script src="js/libs/code/codemirror.js"></script>


<form:form id="bpmNodeEventForm" commandName="model" cssClass="validate"
	action="bpm/nodeSetting/save">
	<div class="box tabbedBox">
		<div class="header">
			<ul>
				<li><a href="#nodeEventInfo">节点脚本</a>
				</li>
				<li><a href="#nodeMessageInfo">节点消息设置</a>
				</li>
				</li>
			</ul>
			<h2>&nbsp;</h2>
		</div>
		<div style="padding:0" class="content tabbed">
			<div id="nodeEventInfo">
				<input type="hidden" name="id" value="${model.id }" />
				<form:hidden path="messageType" />
				<table class="form-table">
					<tr>
						<td class="td1">节点脚本：</td>
						<td class="td2"><form:textarea path="startScriptContent"
								cssStyle="height: 120px" /> <isperp:processVariable
								id="startScriptContentVariable" targetControlId="mirroreditor"
								targetIsEditor="true" processKey="${defKey }"></isperp:processVariable>
							<isperp:operate code="WORKFLOW_DAO" title="数据访问实体dao使用说明"></isperp:operate>
						</td>
					</tr>
				</table>
			</div>
			<div id="nodeMessageInfo">
				<table class="form-table">
					<tr>
						<td class="td1">消息：</td>
						<td class="td2" style="padding:5px 0"><form:checkboxes
								items="${messageTypes }" path="messageTypes" />
							<div style="padding:5px 0">
								<form:input path="startMessageTitle" cssStyle="width:85%" />
							</div> <form:textarea path="startMessage" cssStyle="height: 240px" />
							<isperp:processVariable id="startMessageVariable"
								targetControlId="startMessage" processKey="${defKey }"></isperp:processVariable>
							<div>温馨提示：如果发送短信请控制字数在140字以内。</div></td>
					</tr>
				</table>
			</div>


		</div>
	</div>
</form:form>
<isperp:buttonList>
	<button class="submit"
		onclick="mirroreditor.save();isperp.submitForm({success:function(){isperp.closeDialog();}});return false;">保存</button>
</isperp:buttonList>

<script>
	var mirroreditor = CodeMirror.fromTextArea(document.getElementById("startScriptContent"), {
		mode : "groovy",
		lineNumbers : true,
		tabMode : "indent"
	});
	mirroreditor.on("change", function() {
		clearTimeout(pending);
		setTimeout(update, 400);
	});
	var pending;

	function update() {
		mirroreditor.setOption("mode", "groovy");
	}
</script>